package com.flowplan.entity.enums;

/**
 * 待办状态枚举
 * 
 * @author FlowPlan Team
 */
public enum TodoStatus {
    /**
     * 待处理
     */
    TODO("TODO", "待处理"),
    
    /**
     * 进行中
     */
    IN_PROGRESS("IN_PROGRESS", "进行中"),
    
    /**
     * 已完成
     */
    DONE("DONE", "已完成"),
    
    /**
     * 阻塞
     */
    BLOCKED("BLOCKED", "阻塞");
    
    private final String code;
    private final String description;
    
    TodoStatus(String code, String description) {
        this.code = code;
        this.description = description;
    }
    
    public String getCode() {
        return code;
    }
    
    public String getDescription() {
        return description;
    }
    
    /**
     * 根据代码获取枚举
     */
    public static TodoStatus fromCode(String code) {
        for (TodoStatus status : values()) {
            if (status.code.equals(code)) {
                return status;
            }
        }
        throw new IllegalArgumentException("Invalid todo status code: " + code);
    }
}